﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraGrid;

namespace CIIS.Common
{
    public partial class GridSignature : UserControl
    {
        public GridSignature()
        {
            InitializeComponent();
        }

        public void InitCaption(string detailCaption, string signatureCaption, string dateCaption)
        {
            layoutControlItemGrid.Text = detailCaption;
            layoutControlItemSignature.Text = signatureCaption;
            layoutControlItemDate.Text = dateCaption;
        }

        public void InitControl(string detailCaption, string signatureCaption, string dateCaption, DropdownControlParam dcp)
        {
            layoutControlItemGrid.Text = detailCaption;
            layoutControlItemSignature.Text = signatureCaption;
            layoutControlItemDate.Text = dateCaption;

            dateEditQzsj.DateTime = DateTime.Today;
            DevControlUtils.Instance.InitSearchLookUpEdit(searchLookUpEditQz, dcp);
        }

        public void SetValues(object[] values)
        {
            if (values == null || values.Length != 2)
            {
                return;
            }

            searchLookUpEditQz.EditValue = values[0];
            DateTime? sj = values[1] as DateTime?;
            if (sj.HasValue)
            {
                dateEditQzsj.DateTime = sj.Value;
            }
        }


        public DateTime Qzsj
        {
            get { return dateEditQzsj.DateTime; }
        }

        public string Qz
        {
            get { return searchLookUpEditQz.EditValue != null ? searchLookUpEditQz.EditValue.ToString() : string.Empty; }
        }

        public SimpleGridControl Gc
        {
            get { return gridControl1; }
        }
    }
}
